package com.xhui.vimarket.zkplus.zul.attr.mod.impl;t java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.directwebremoting.util.Logger;
import org.zkoss.zk.ui.Component;
import org.zkoss.zul.Hbox;
import org.zkoss.zul.Label;
com.xhui.vimarket.zkplusui.vimarket.zkplus.zul.attrcom.xhui.vimarket.zkplusrt com.xhui.vimarket.zkplus.zul.acom.xhui.vimarket.zkplusst;
import com.xhui.vimarket.zkplus.zul.attr.bean.AttrTmpl;

/**com.xhui.vimarket.zkplus权所有 (c) 2010
 * @文件：com.xhui.vimarket.zkplus.zul.attr.mod.impl.AttrLabelComp.java
 * @所含类：
 * @author: wuyx
 * @version: V1.0
 * @see:
 * @创建日期：2010-12-20
 * @功能说明：属性控件接口
 * @修改记录： =============================================================<br>
 *        日期:2010-12-20 创建
 *        =============================================================<br>
 */
public class AttrLabelComp extends AttrBaseComp {
    
    /**
     * 实例.
     */
    private static AttrLabelComp inst   = new AttrLabelComp();
    
    /**
     * 日志.
     */
    private static Logger        logger = Logger.getLogger(AttrLabelComp.class);
    
    /**
     * 构造函数. 
     */
    private AttrLabelComp() {
    }
    
    /**
     * 获取实例.
     * 
     * @return AttrBaseComp
     */
    public static AttrLabelComp instance() {
        return AttrLabelComp.inst;
    }
    
    /**
     * 生成组件.
     * 
     * @param attrExt 组件控件
     * @param attrTmpl 组件模板
     * @param comp 显示容器组件
     */
    @Override
    public void create(final AttrExt attrExt, final AttrTmpl attrTmpl, final Component comp) {
        super.create(attrExt, attrTmpl, comp);
        // panel
        final Hbox hbox = new Hbox();
        hbox.setAttribute(AttrBaseComp.COMP_MODE, attrTmpl.getDisplayMode());
        hbox.setAttribute(AttrBaseComp.COMP_ATTRID, attrTmpl.getAttrId());
        hbox.setWidth("100%");
        final Label label = new Label(attrTmpl.getName());
        // add to zul
        hbox.setParent(comp);
        label.setParent(hbox);
        if (attrTmpl.getHint() != null) {
            hbox.setTooltiptext(attrTmpl.getHint());
        }
        // comp log
        if (AttrLabelComp.logger.isDebugEnabled()) {
            attrExt.appendInnerComp("<hbox width=\"100%\">");
            attrExt.appendInnerCompAttr(AttrBaseComp.COMP_MODE, attrTmpl.getDisplayMode());
            attrExt.appendInnerCompAttr(AttrBaseComp.COMP_ATTRID, "" + attrTmpl.getAttrId());
            attrExt.appendInnerComp("<label value=\"");
            attrExt.appendInnerComp(attrTmpl.getName());
            attrExt.appendInnerComp("\" />");
            attrExt.appendInnerComp("</hbox>");
        }
        
        super.afterCreate(attrExt, attrTmpl, comp);
    }
    
    /**
     * 设置值.
     * 
     * @param attrExt 组件控件
     * @param comp 组件
     * @param attrInst 属性实例
     */
    @Override
    public void setValue(final AttrExt attrExt, final Component comp,
        final List<AttrInst> attrInstList,final Map<String, Integer> attrViewMap) {
        super.setValue(attrExt, comp, attrInstList,attrViewMap);
    }
    
    /**
     * 取空值属性实例.
     * 
     * @param attrExt 组件控件
     * @param attrTmpl 模板
     */
    @Override
    public ArrayList<AttrInst> getNullValue(final AttrExt attrExt, final AttrTmpl attrTmpl) {
        super.getNullValue(attrExt, attrTmpl);
        return null;
    }
    
    /**
     * 获取值.
     * 
     * @param attrExt 组件控件
     * @param comp 组件
     * @return ArrayList<AttrInst>
     */
    @Override
    public ArrayList<AttrInst> getValue(final AttrExt attrExt, final Component comp) {
        super.getValue(attrExt, comp);
        return null;
    }
    
}
